@{
    ViewBag.Title = "Base62解码 - Base62编码解码";
    ViewBag.keywords = "Base62编码解码,Base62在线转换工具";
    ViewBag.description = "Base62使用数字0-9和字母A-F共计62个ASCII可打印字符对任意字节数据进行编码。";var host = Appsettings.app("BaseFile:HostUrl");
}
<div class="layui-row">
    <div class="layui-elem-quote">
        <p>
            Base编码系列：
            <a href="/base16" style="color:blue">Base16</a>
            <a href="/base32" style="color:blue">Base32</a>
            <a href="/base58" style="color:blue">Base58</a>
            <a href="/base62" style="color:blue">Base62</a>
            <a href="/base64" style="color:blue">Base64</a>
            <a href="/base91" style="color:blue">Base91</a>
        </p>
    </div>
</div>
<div class="layui-row layui-form layui-form-pane">
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容：</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" id="content" name="content" rows="8" lay-verify="required" autocomplete="off" class="layui-textarea">www.ruovea.com</textarea>
        </div>
    </div>

    <div class="layui-form-item base62">
        <div class="layui-input-block">
            <a class="layui-btn enc">加密</a>
            <a class="layui-btn layui-btn-normal dec">解密</a>
            <a class="layui-btn layui-btn-danger cle">清空</a>
            <a class="layui-btn layui-btn-primary copy">复制结果</a>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">输出：</label>
        <div class="layui-input-block">
            <textarea placeholder="输出内容" id="outtxt" name="outtxt" rows="8" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
</div>

@section Scripts{
<script src="@host/lib/base62.js"></script>
<script>

    layui.config({ base: '@host/js/' }).use('common',function(){var common=layui.common;
        $=layui.jquery;
    let area_input = document.getElementById('content');
    let area_output = document.getElementById('outtxt');

    $(".base62 .enc").bind("click", function () {
        try {
            var inptxt = area_input.value;
            if (inptxt === undefined || inptxt === '' || inptxt === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
            area_output.value = $d.encodeBase62(inptxt);
        } catch (err) {
            console.log(err)
            layer.msg("加密失败", { icon: 2 });
        }
    });

    $(".base62 .dec").bind("click", function () {
        try {
            var inptxt = area_input.value;
            if (inptxt === undefined || inptxt === '' || inptxt === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
            area_output.value = $d.decodeBase62(inptxt);

        } catch (err) {
            console.log(err)
            layer.msg("解密失败", { icon: 2 });
        }
    });
    });

</script>
}
